             package com.java.diagnostics.visualizer.recommender.switchToBalanced;
             
             import com.java.diagnostics.visualizer.data.AggregateData;
             import com.java.diagnostics.visualizer.data.DataPoint;
             import com.java.diagnostics.visualizer.data.TupleData;
             import com.java.diagnostics.visualizer.parser.vgc.constants.VGCGCReasons;
             import com.java.diagnostics.visualizer.parser.vgc.constants.VGCGCScopes;
             import com.java.diagnostics.visualizer.recommender.Recommendation;
             import com.java.diagnostics.visualizer.recommender.RecommendationBase;
             import com.java.diagnostics.visualizer.recommender.util.RecommendationLabels;
             import java.text.MessageFormat;
             
             public class LookForLongGlobals
               extends RecommendationBase
               implements Recommendation
             {
               public void recommend(AggregateData data)
               {
                 Object gcMode = getGCMode(data);
                 
                 if (("gencon".equals(gcMode)) && (is26VM(data))) {
                   TupleData scopeRecord = data
                     .getTupleData("VGCLabels.gc.scopes");
                   TupleData pauseTimes = data
                     .getTupleData("VGCLabels.pause.times.without.exclusive.access");
                   TupleData reasonRecord = data
                     .getTupleData("VGCLabels.gc.reasons");
                   if ((scopeRecord != null) && (pauseTimes != null) && 
                     (reasonRecord != null)) {
                     DataPoint[] pausesPoints = pauseTimes.getDataPoints();
                     double nurseryTotal = 0.0D;
                     int nurseryPauses = 0;
                     
                     for (DataPoint pause : pausesPoints) {
                       if (isCollectionOfGivenScope(scopeRecord, pause, 
                         VGCGCScopes.SCAVENGE_INT)) {
                         nurseryTotal += pause.getRawY();
                         nurseryPauses++;
                       }
                     }
                     double meanNursery = nurseryTotal / nurseryPauses;
                     
                     int longGlobals = 0;
                     double globalTotal = 0.0D;
                     for (DataPoint pause : pausesPoints) {
                       if (isCollectionOfGivenScope(scopeRecord, pause, 
                         VGCGCScopes.GLOBAL_INT)) {
                         double reason = reasonRecord.getDataPoint(
                           pause.getSequenceUID()).getRawY();
                         
                         if ((reason != VGCGCReasons.SYS_INT) && 
                           (pause.getRawY() > 5.0D * nurseryTotal / nurseryPauses)) {
                           globalTotal += pause.getRawY();
                           longGlobals++;
                         }
                       }
                     }
                     
                     if (longGlobals > 0) {
                       double meanGlobal = globalTotal / longGlobals;
                       long percent = Math.round(meanGlobal / meanNursery * 100.0D);
                       
                       addWarning(data, MessageFormat.format(
                         RecommendationLabels.LONG_GENCON_GLOBALS_WARNING, 
                         new Object[] { Integer.valueOf(longGlobals), Long.valueOf(percent) }));
                     }
                   }
                 }
               }
             }


